package com.baitengsoft.patentservicemonitor.job.cloud.patent.hub.enums;

import cn.hutool.core.util.StrUtil;

/**
 * @author wangze
 * @date 2018-08-28 8:51.
 **/
public enum PatentTypeEnum {
    Invent(1, "发明专利"), Utility(2, "实用新型"), Design(3, "外观设计");
    private int index;
    private String name;


    PatentTypeEnum(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static Integer getType(String name) {
        if (StrUtil.isBlank(name)) {
            return null;
        }
        switch (name) {
            case "发明公开":
                return PatentTypeEnum.Invent.index;
            case "发明授权":
                return PatentTypeEnum.Invent.index;
            case "实用新型":
                return PatentTypeEnum.Utility.index;
            case "外观设计":
                return PatentTypeEnum.Design.index;
            default:
                return null;
        }
    }
}
